#ifndef __DUNGEON_SCENE_H__
#define __DUNGEON_SCENE_H__

#include "cocos2d.h"
#include "SimpleAudioEngine.h"

#define MAP_WIDTH	8
#define MAP_HEIGHT	8
#define PARTY_MAX	4

class Dungeon : public cocos2d::CCLayer
{
private:
	int hero_x, hero_y;
	int map[MAP_WIDTH][MAP_HEIGHT];

	CCNode* left_arrow;
	CCNode* right_arrow;
	CCNode* up_arrow;
	CCNode* down_arrow;

	int sight;
	int skill_user;

	bool CreateMenu();
	bool CreateParty();
	bool CreateSkillMenu();
	bool CreateInfo();

	bool AddLabel(char* msg, int x, int y, int size, int tag = -1, float anchor_x = 0.0f, float anchor_y = 0.0f);
	bool AddLabel(char* msg, int x, int y, int size, CCNode* parent, int z_order, int tag = -1);
	bool AddSprite(const char* file_name, int x, int y, int z, int tag = -1);
	void RefreshMove();
	void TimePass(int t);
	void RefreshInfo();
	void SkillMenu(int user_id);

	void ShowArrow();
	void HideArrow();
	void ShowParty();
	void HideParty();
	void ShowSkillMenu();
	void HideSkillMenu();

public:
	static int floor;
	static int left_time;
	static int party_id[PARTY_MAX];

	static void SetParty(int party1 = -1, int party2 = -1, int party3 = -1, int party4 = -1);

	// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommand to return the exactly class pointer
    static cocos2d::CCScene* scene();
    
    // a selector callback
	virtual void moveLeft(CCObject* pSender);
	virtual void moveRight(CCObject* pSender);
	virtual void moveUp(CCObject* pSender);
	virtual void moveDown(CCObject* pSender);

	virtual void Party1Skill(CCObject* pSender);
	virtual void Party2Skill(CCObject* pSender);
	virtual void Party3Skill(CCObject* pSender);
	virtual void Party4Skill(CCObject* pSender);

	virtual void SkillCommand1(CCObject* pSender);
	virtual void SkillCommand2(CCObject* pSender);
	virtual void SkillBack(CCObject* pSender);

    // implement the "static node()" method manually
	CREATE_FUNC(Dungeon);
};

#endif  // __DUNGEON_SCENE_H__